package com.itheima.yuanzixing;

import java.util.concurrent.atomic.AtomicLong;

/*
compareAndSet()
 */
public class Demo02 {

    public static void main(String[] args) {

        AtomicLong al = new AtomicLong(10L);
        boolean b = al.compareAndSet(10, 20);
        System.out.println(b);
        System.out.println(al.get());
        boolean b2 = al.compareAndSet(100, 20);
        System.out.println(b2);
        System.out.println(al.get());
    }
}
